﻿using System;
using System.Windows.Forms;

namespace BuildStatusIndicator.BuildScreen
{
    public partial class BuildScreenForm : Form, IBuildScreenView
    {
        private BuildScreenPresenter _presenter;

        public BuildScreenForm()
        {
            InitializeComponent();
        }

        #region IBuildScreenView Members

        public void SetBuildNumber(string number)
        {
            lblBuildNumber.Text = number;
        }

        public void SetRequestedFor(string requestedFor)
        {
            lblRequestedFor.Text = requestedFor;
        }

        public void SetFinishTime(string finishTime)
        {
            lblFinishTime.Text = finishTime;
        }

        public void SetStatus(string status)
        {
            lblStatus.Text = status;
        }

        public void SetFailedImage()
        {
            statusPictureBox.Image = StatusImages.status_bad;
        }

        public void SetNotStartedImage()
        {
            statusPictureBox.Image = StatusImages.status_queue;
        }

        public void SetPartiallySucceededImage()
        {
            statusPictureBox.Image = StatusImages.status_partial;
        }

        public void SetStoppedImage()
        {
            statusPictureBox.Image = StatusImages.status_stop;
        }

        public void SetSucceededImage()
        {
            statusPictureBox.Image = StatusImages.status_good;
        }

        public void SetInProgressImage()
        {
            statusPictureBox.Image = StatusImages.status_queue;
        }

        public void SetLastUpdated(string lastUpdated)
        {
            lblLastUpdated.Text = lastUpdated;
        }

        public void AttachPresenter(BuildScreenPresenter presenter)
        {
            _presenter = presenter;
        }

        #endregion

        private void WallboardForm_Load(object sender, EventArgs e)
        {
            _presenter.ViewLoad();
        }

        private void WallboardForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            _presenter.ViewClosing();
        }
    }
}